import WxValidate from "../../utils/WxValidate"
Page({
  data: {
    code:null,
    password:null,
    checked:false,
    WxValidate:{}
  },
  onLoad() {
         //初始化验证参数
         this.initValidate()
  },
  initValidate() {
    const rules = {
      code: {
        required: true,
      },
      password:{
        required: true,
      },
      
    }
    const messages = {
      code: {
        required: '请输入员工号'
      },
      password: {
        required: '请输入密码'
      }
    }
    this.WxValidate = new WxValidate(rules, messages)
  },
  submitBtn(e) {
    if (!this.WxValidate.checkForm(e.detail.value)) {
      const error = this.WxValidate.errorList[0]
      wx.showToast({
        title: error.msg,
        icon: "none",
        duration: 800
      })
      return false
    }
  },
  /**
   *  复选框
   */
  onChangeChecked(event) {
    this.setData({
      checked: event.detail,
    })
  },

})
